package net.ebakker.feededitor;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;

public class Preferences {

	private Properties preferences = new Properties();
	private File prefFile;
	private String pgUsername;
	private String pgPassword;
	private String pgHost;
	private int pgPort;
	private String pretomeKey;

	public Preferences(File prefFile) {
		this.prefFile = prefFile;
		loadPreferences();
	}

	private void loadPreferences() {
		try {
			preferences.load(new FileInputStream(prefFile));
		} catch (IOException e) {
			e.printStackTrace();
		}

		pgUsername = preferences.getProperty("pgUsername");
		pgPassword = preferences.getProperty("pgPassword");
		pgHost = preferences.getProperty("pgHost");
		pgPort = Integer.parseInt(preferences.getProperty("pgPort"));
		pretomeKey = preferences.getProperty("pretomeKey");
	}

	public String getPgUsername() {
		return pgUsername;
	}

	public String getPgPassword() {
		return pgPassword;
	}

	public String getPgHost() {
		return pgHost;
	}

	public int getPgPort() {
		return pgPort;
	}

	public String getPretomeKey() {
		return pretomeKey;
	}
}
